<template>
  <cus-table 
    :page="page" 
    @dataChange="getPage"
    :cols="cols">
  </cus-table>
</template>

<script>
import CusTable from '~/components/cus_table/CusTable.vue'

const cols = [
  {prop: 'id', label: '序号'},
  {prop: 'username', label: '用户名'},
  {prop: 'operation', label: '操作'},
  {prop: 'time', label: '操作时间s'},
  {prop: 'createDate', label: '创建时间'}
]

export default {
  name: 'sys-log',
  components: {CusTable},
  created () {
    this.getPage({page: 1, pageSize: 10});
  },
  head () {
    return {
      meta: [{
        title: 'sys-log'
      }]
    }
  },
  data () {
    return {
      cols: cols
    }
  },
  computed: {
    page () {
      return this.$store.state.sys.logs;
    }
  },
  methods: {
    getPage (params) {
      this.$store.commit('sys/resetLoading', 'logs');
      this.$store.dispatch('sys/getLogs', params);
    }
  }
}
</script>

